
<?php 
require('prepend.inc.php');//all the qcode pages will include this line basically.
//this 'protected'.inc.php is just for after_logiend_pages and functions.
//'prepend'.inc.php have to be required for all the pages but not this 'protected' file.
//The header is for all the paegs and header includes the login checking but
//protected should not be used for header if we use your menu bar implementations by one file.
//please consider and understand the way of simple qcodo coding.
//all the pages should have .php file and .tpl.php basically in qcodo.
//please follow something in example code from qcodo.
//I am just following the way of existing working and tested code.
//That will be easier to avoid problems.
//for admin features we will create and include something like admin_only.inc.php
//it is easy to manage any permissions in qcodo by adding these files.

if (!isset($_SESSION['User']))
QApplication::Redirect('index_login.php');//index_login.php is a index with login form.
$objUser = unserialize($_SESSION['User']);
// make sure no errors occured in translation and the session's User variable is a user object
if (!($objUser instanceof TableUserProject))
QApplication::Redirect('index_login.php');
  
/*function userAuth($redirect = true){
  	if(!isset($_SESSION['User'])){
		if($redirect == true){
			session_unset();
			session_destroy();
			session_regenerate_id();
			cnHeader( '/login.html');
			//header(WH_URL.'login.html');
		}else{
			return false;
		}
	}else{
  		return true;
	}
  }
  
   function cnHeader($url = '', $modname = ''){
  	if($modname == '' || $url == ''){
  		header('Location: '. __SUBDIRECTORY__.$url);
	}else{
	header('Location: '. __SUBDIRECTORY__.CN_MODULES.'/'.$modname.'/'.$url);
	}
	exit();
   }*/
?>